//
//  MZCancellable.swift
//  MZTool
//
//  Created by gby on 2023/2/7.
//

import Foundation


public protocol MZCancellable {
    
    var isCancelled: Bool {get}
    
    func cancel()
}




internal class MZCancellableWrapper: MZCancellable {
    internal var innserCancellable: MZCancellable = MZCancellableSimple()
    
    var isCancelled: Bool { innserCancellable.isCancelled }
    
    internal func cancel() {
        innserCancellable.cancel()
    }
}



internal class MZCancellableSimple: MZCancellable {
    var isCancelled = false
    func cancel() {
        isCancelled = true
    }
}
